:root {
    --primary-color: #4A6FFF;
    --background-gradient: linear-gradient(135deg, #2B4162 0%, #394F73 100%);
    --text-color: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --card-background: rgba(255, 255, 255, 0.15);
    --border-radius: 16px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    --border: 1px solid rgba(255, 255, 255, 0.1);
    --theme-toggle-bg: rgba(255, 255, 255, 0.15);
    --theme-toggle-color: #FFFFFF;
    --theme-toggle-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --button-background: rgba(74, 111, 255, 0.8);
    --button-hover-background: rgba(74, 111, 255, 0.9);
    --button-text: #FFFFFF;
    --delete-hover: rgba(255, 69, 58, 0.85);
}

/* Dark mode variables */
[data-theme="dark"] {
    --background-gradient: linear-gradient(135deg, #1A1F2C 0%, #2C3347 100%);
    --text-color: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --card-background: rgba(41, 47, 61, 0.7);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
    --border: 1px solid rgba(255, 255, 255, 0.05);
    --theme-toggle-bg: rgba(41, 47, 61, 0.9);
    --theme-toggle-color: #FFFFFF;
    --theme-toggle-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --button-background: rgba(74, 111, 255, 0.7);
    --button-hover-background: rgba(74, 111, 255, 0.8);
}

/* Theme switch styles */
.theme-switch {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.theme-toggle-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: var(--border);
    background: var(--theme-toggle-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--theme-toggle-shadow);
    transition: all 0.3s ease;
    padding: 0;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.sun-icon,
.moon-icon {
    position: absolute;
    fill: var(--theme-toggle-color);
    transition: all 0.3s ease;
}

.sun-icon {
    opacity: 1;
    transform: scale(1);
}

.moon-icon {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="dark"] .sun-icon {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
    transform: scale(1);
}

.theme-transition {
    transition: background 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background: var(--background-gradient);
    min-height: 100vh;
    padding: 2rem;
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}
/* 上传区域样式 */
.upload-area {
    /* 使用变量设置背景颜色 */
    background: var(--card-background);
    /* 使用变量设置边框圆角 */
    border-radius: var(--border-radius);
    /* 设置内边距 */
    padding: 2rem;
    /* 设置底部外边距 */
    margin-bottom: 2rem;
    /* 使用变量设置阴影效果 */
    box-shadow: var(--shadow);
    /* 使用变量设置背景模糊效果 */
    backdrop-filter: blur(16px);
    /* 使用变量设置背景模糊效果（兼容webkit内核浏览器） */
    -webkit-backdrop-filter: blur(16px);
    /* 使用变量设置边框样式 */
    border: var(--border);
}

.upload-button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: var(--button-background);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    color: var(--button-text);
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-button:hover {
    background: var(--button-hover-background);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

#file-input {
    display: none;
}

.preview-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.preview-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--card-background);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--border);
}

.preview-item img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
}

.image-name {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    max-width: calc(100% - 50px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1;
}

.delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: var(--delete-hover);
    transform: rotate(90deg);
}

#stitch-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    background: var(--button-background);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: none;
    box-shadow: var(--shadow);
    color: var(--button-text);
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#stitch-btn:disabled {
    background: rgba(128, 128, 128, 0.5);
    cursor: not-allowed;
}

#stitch-btn:not(:disabled):hover {
    background: var(--button-hover-background);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.result-area {
    margin-top: 2rem;
    text-align: center;
}

.result-area img {
    max-width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.upload-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.drag-tip {
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.8;
}

.preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.preview-item.dragging {
    opacity: 0.5;
    background: rgba(255, 255, 255, 0.4);
}